package com.system.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.base.common.service.CrudService;
import com.system.dao.UserInfoMapper;
import com.system.model.UserInfo;
import com.system.service.UserInfoService;

@Service
public class UserInfoServiceImpl extends CrudService<UserInfoMapper, UserInfo>
		implements UserInfoService {
	
	public UserInfo getUserInfo(String userId) throws Exception {
		Map<String, String> params = new HashMap<String, String>();
		params.put("userId", userId);
		String sql = "SELECT * from user_info t where t.id = #{userId}";
		UserInfo user = this.getOne(sql, UserInfo.class, params);
		return user;
	}
	
	public UserInfo getUserInfoByCompanyIdAndType(String companyId, String type) throws Exception {
		Map<String, String> params = new HashMap<String, String>();
		params.put("companyId", companyId);
		params.put("type", type);
		String sql = "SELECT * from user_info t where t.company_Id = #{companyId} and t.user_type = #{type}";
		UserInfo user = this.getOne(sql, UserInfo.class, params);
		return user;
	}
	
}
